﻿using System.ComponentModel.DataAnnotations;
using System.Net.Mime;
using System.Web;
using Library.Models;
using Library.MVCHelpers;

namespace Ecommerce.Models
{
    public class ContactViewModel
    {
        public ContactViewModel()
        { }

        public ContactViewModel(Contact contact)
        {
            SenderName = contact.SenderName;
            SenderEmail = contact.SenderEmail;
            Content = contact.Content;
        }

        [CultureRequired]
        [CultureMaxLength(50)]
        [Display(Name = "Full name")]
        public string SenderName { get; set; }

        [CultureRequired]
        [CultureMaxLength(50)]
        [CultureEmailAddress]
        [Display(Name = "Email")]
        public string SenderEmail { get; set; }

        [CultureRequired]
        [CultureMaxLength(500)]
        public string Content { get; set; }

        public string ReturnUrl { get; set; }
    }

    public class ImageViewModel
    {
        public ImageViewModel() { }

        [DataType(DataType.Upload)]
        public HttpPostedFileBase Image { get; set; }

        public string Src { get; set; }

        [CultureRequired]
        [CultureMaxLength(150)]
        [Display(Name = "Image ALT text")]
        public string AltText { get; set; }

        [CultureMaxLength(150)]
        [Display(Name = "Image caption")]
        public string Caption { get; set; }
        public int? Width { get; set; }
        public int? Height { get; set; }
    }

    public class BreadcrumbViewModel
    {
        public BreadcrumbViewModel(string url, string text, bool isActive, string headingTag)
        {
            Url = url;
            Text = text;
            IsActive = isActive;
            HeadingTag = headingTag;
        }

        public BreadcrumbViewModel(string url, string text, bool isActive)
            : this(url, text, isActive, string.Empty)
        {
            
        }

        public BreadcrumbViewModel(string url, string text, string headingTag)
            : this(url, text, false, headingTag)
        {

        }

        public BreadcrumbViewModel(string url, string text)
            : this(url, text, false, string.Empty)
        {

        }

        public string Url { get; set; }
        public string Text { get; set; }
        public bool IsActive { get; set; }
        public string HeadingTag { get; set; }
    }
}